
/*
 * Copyright 2002-2020 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 *版权所有2002-2020原作者。
 *
 *根据Apache许可证2.0版（“许可证”）许可；
 *除非符合许可证的规定，否则您不得使用此文件。
 *您可以在以下网址获取许可证副本
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 *除非适用法律要求或书面同意，否则软件
 *根据许可证分发是在“按原样”的基础上分发的，
 *无任何明示或暗示的保证或条件。
 *有关管理权限的特定语言，请参阅许可证
 *许可证下的限制。
 */

package org.springframework.context.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Indicates that a component is only eligible for registration when all
 * {@linkplain #value specified conditions} match.
 *
 * <p>A <em>condition</em> is any state that can be determined programmatically
 * before the bean definition is due to be registered (see {@link Condition} for details).
 *
 * <p>The {@code @Conditional} annotation may be used in any of the following ways:
 * <ul>
 * <li>as a type-level annotation on any class directly or indirectly annotated with
 * {@code @Component}, including {@link Configuration @Configuration} classes</li>
 * <li>as a meta-annotation, for the purpose of composing custom stereotype
 * annotations</li>
 * <li>as a method-level annotation on any {@link Bean @Bean} method</li>
 * </ul>
 *
 * <p>If a {@code @Configuration} class is marked with {@code @Conditional},
 * all of the {@code @Bean} methods, {@link Import @Import} annotations, and
 * {@link ComponentScan @ComponentScan} annotations associated with that
 * class will be subject to the conditions.
 *
 * <p><strong>NOTE</strong>: Inheritance of {@code @Conditional} annotations
 * is not supported; any conditions from superclasses or from overridden
 * methods will not be considered. In order to enforce these semantics,
 * {@code @Conditional} itself is not declared as
 * {@link java.lang.annotation.Inherited @Inherited}; furthermore, any
 * custom <em>composed annotation</em> that is meta-annotated with
 * {@code @Conditional} must not be declared as {@code @Inherited}.
 *
 * @author Phillip Webb
 * @author Sam Brannen
 * @since 4.0
 * @see Condition
 */
/**
 *指示组件只有在所有
 *｛@linkplain#值指定的条件｝匹配。
 *
 *<p><em>条件</em>是可以通过编程确定的任何状态
 *在bean定义被注册之前（有关详细信息，请参阅{@linkCondition}）。
 *
 *<p>｛@code@Conditional｝注释可以以以下任何方式使用：
 *＜ul＞
 *<li>作为任何类上的类型级注释，直接或间接注释为
 *｛@code@Component｝，包括｛@link Configuration@Configuration｝类</li>
 *＜li＞作为一个元注释，用于组成自定义构造型
 *注释</li>
 *<li>作为任何{@link-Bean@Bean}方法的方法级注释</li>
 *</ul>
 *
 *<p>如果用{@code@Conditional}标记{@code@Configuration}类，
 *所有的｛@code@Bean｝方法、｛@link Import@Import｝注释，以及
 *｛@link ComponentScan@ComponentScan｝与之关联的注释
 *课程将根据条件而定。
 *
 *<p><strong>注释</strong>：｛@code@Conditional｝注释的继承
 *不支持；超类或重写的任何条件
 *方法将不予考虑。为了实施这些语义，
 *｛@code@Conditional｝本身未声明为
 *｛@link java.lang.annotation.Inherited@Inherited｝；此外，任何
 *自定义<em>组合注释</em>，使用进行元注释
 *｛@code@Conditional｝不能声明为｛@code@Inherited｝。
 *
 *@作者Phillip Webb
 *@作者Sam Brannen
 *@自4.0起
 *@见条件
 */
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Conditional {

	/**
	 * All {@link Condition} classes that must {@linkplain Condition#matches match}
	 * in order for the component to be registered.
	 */
	/**
	 *所有必须｛@linkplain Condition#匹配的｛@link Condition｝类都匹配｝
	 *以便对该组件进行注册。
	 */
	Class<? extends Condition>[] value();

}
